<template>
    <div>
        {{ initNum.number.toFixed(2) }}
    </div>
</template>
<script setup>
import gsap from 'gsap';
import { reactive, watch } from 'vue'
const props = defineProps({
    num: {
        type: Number,
        default: 0,
    }
});
const initNum = reactive({
    number: 0,
})

function animateCount() {
    gsap.to(initNum, {
        duration: 0.5,
        number: props.num,
    })
}
animateCount();
watch(() => props.num, () => {
    animateCount();
})
</script>
<style scoped lang='scss'></style>
